package bean.response;

/**
 * 返回类型的枚举类
 * https://blog.csdn.net/duninet/article/details/103407468
 * @author Seven
 * @date 2021/11/20
 */

public enum ResultEnum {
    //返回码
    OK(200,"请求处理处理成功"),
    CREATED(201,"用户修改数据成功"),
    NO_CONTENT(204,"用户删除数据成功"),
    INVALID_REQUEST(400,"用户发出的请求有误"),
    UNAUTHORIZED(401,"用户未登录或登录失败"),
    FORBIDDEN(403,"用户未授权，访问禁止"),
    NOT_FOUND(404,"用户发出请求不存在"),
    NOT_ACCEPTABLE(406,"用户请求格式有误"),
    GONE(410,"用户请求的数据已经被删除，且不会再获取到"),
    UN_ENTITY(422,"创建对象时，验证出错"),
    ERROR(500,"服务器出了问题，暂不能处理,无法判断请求是否成功"),

    BAD_REQUEST(400,"请求出错"),
    BIND_ERROR(501,"参数校验异常");


    private Integer code;
    private String message;

    ResultEnum(int code, String message) {
        this.setMessage(message);
        this.setCode(code);
    }

    public void setMessage(String message){
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }
}
